package com.example.studyPlatform.controller.api.kit;

import java.util.Objects;

public class UrlUtils {
    public static String normUrl(String url) {
        Objects.requireNonNull(url);
        url = url.replace(" ", "")
                .replace('\\', '/')
                .replaceAll("/+", "/")
                .replaceAll("(^/)|(/$)","");
        return url;
    }
    public static boolean isResources(String url){
        return url.endsWith(".js")
                ||url.endsWith(".gif")
                ||url.endsWith(".css")
                ||url.endsWith(".jpg")
                ||url.endsWith(".png")
                ||url.endsWith(".ico")
                ||url.endsWith(".html")
                ||url.endsWith(".svg")
                ||url.endsWith(".mp3")
                ||url.endsWith(".mp4")
                ;
    }
}
